This invention generally relates to computer systems and more particularly, to data sequencing within computer systems.
Data in a computer system may be organized in different formats. Three methods commonly used are little endian, big endian, and bitmap formats. Little and big endian formats vary the significance of bytes in multibyte words. In big endian systems, for example, the leftmost bytes are most significant. In little endian systems, however, the rightmost bytes are most significant. Computer systems can be configured to handle either or both types of endian data formats.
A graphical image may be represented in computer memory by the well known bitmap format. More particularly, in systems that utilize bitmap formats, data streams of ones and zeros may be produced by means of a simple sequencer. The ones and zeros in the stream may represent the state of pixels, for example, on a computer monitor. A xe2x80x9c1xe2x80x9d value, for example, may represent a lit pixel, while a xe2x80x9c0xe2x80x9d value may represent an unlit pixel. The combination of lit and unlit pixels produce a text character on a computer monitor.
Systems utilizing either or both the big and little endian formats, however, require special handling to reorder the data into a format that is understandable to a downstream device such as, for example, a computer monitor or a printer. FIG. 1 shows a prior art system for sequencing received 32-bit data or words (from a microprocessor, for example) into a readable format for the downstream device. Each 32-bit word (input word 10) received by the system has four bytes; namely B0, B1, B2, and B3. In this system, four possible types of word formats (represented by word codes xe2x80x9c00xe2x80x9d, xe2x80x9c01xe2x80x9d, xe2x80x9c10xe2x80x9d and xe2x80x9c11xe2x80x9d) may be converted into a readable bit stream 17. Specifically, the four disclosed bytes (B0, B1, B2, and B3) are positioned at different locations within each word defined by each of the four word formats. Upon receipt of one of the four word formats, the system of FIG. 1 first reorders the bytes to the order defined by the word format identified by the word code xe2x80x9c00xe2x80x9d (i.e., little endian format). This reordering is performed by passing the four bytes through a 32-bit wide 4-to-1 multiplexer 11. The 4-to-1 multiplexer 11 has four one-byte wide inputs for receiving each of the four bytes of the input word 10. The multiplexer has a two-bit select input 15 for receiving the word code. The 4-to-1 multiplexer 11 is configured to reorder the received word based upon the word code received by the select input 15. For example, for the word code xe2x80x9c00xe2x80x9d (i.e., little endian format), the bytes of the input word 10 will be reordered to B0, B1, B2, B3.
After the input word 10 is reordered, the system utilizes a sequencer 18 to produce a bit stream 17 that has the bits arranged in a preselected order for use by the downstream hardware device. To that end, the sequencer 18 includes a 5-bit counter 12 and a 32-to-1 multiplexer 13. In the embodiment shown, the counter 12 counts from 0 to 31 which, when such data is received by the 32-to-1 multiplexer 13, causes the 32-to-1 multiplexer 13 to read first from the first multiplexer input line (i.e., the least significant bit), then the second multiplexer input line, etc. until the final (thirty-second) multiplexer input line (i.e., the most significant bit) is read. A drawback to the sequencer 18 shown in FIG. 1, however, is the large amount of circuit area and delay time taken up by the 32-bit 4-to-1 multiplexer 11.
In accordance with one aspect of the invention, a system converts an input data stream in a first format (identified by a first stream code having at least two bits) into an output data stream in a second format. To that end, the system includes, among other things, a data sequencer for sequencing the input data stream. The sequencer includes a select input having a first number of selection input locations, a data input for receiving the input data stream, and output for transmitting the output data stream. The system further includes a counter having the first number of selection outputs, and first and second logic elements that are each connected to different selection input locations of the data sequencer. More particularly, the first logic element has an output coupled to a first of the selection input locations, and a two-bit input for receiving at least two bits. One bit input of the two-bit input receives a first bit of the stream code, while a second bit input of the two-bit input is coupled to one of the selection outputs of the counter. In a similar manner, the second logic element has an output coupled to a second of the selection input locations, and a two-bit input for receiving at least two bits. One bit input of the two-bit input receives a second bit of the stream code, while a second bit input of the two-bit input is coupled to a second of the selection outputs of the counter. In preferred embodiments, the first and second logic elements control the data sequencer to convert the input data stream into the output data stream in the second format.
In preferred embodiments, the first data stream is received from a first computer element such as, for example, a computer microprocessor, while the second data stream is directed to another computer element such as, for example, a computer monitor or a printer. Moreover, the logic elements preferably are exclusive-or (xe2x80x9cXORxe2x80x9d) gates, or other devices producing equivalent output. In some embodiments, the first and second data formats are endian formats.
In other aspects of the invention, the second bit input of the first logic element is coupled to a first selection output of the counter, and the second bit input of the second logic element is coupled to a second selection output of the counter. In preferred embodiments, the first selection output outputs a more significant bit than that outputted by the second selection output. In other embodiments, the counter counts consecutively ascending numbers between zero and thirty-one. In a preferred embodiment, the counter is a modulo counter. In yet another embodiment, the system further includes a third logic element which has as output coupled to a third of the selection input locations, and a two-bit input for receiving at least two bits. One bit input of the two-bit input receives a third bit of the stream code, while a second bit input of the two-bit input is coupled to one of the selection outputs of the counter.